<?php
/**
 * Created by PhpStorm.
 * User: Sky
 * Date: 16/1/25
 * Time: 下午2:51
 */
use yii\helpers\Html;
use yii\helpers\Url;
use app\lib\WeixinUtils;

/* @var $this yii\web\View */
/* @var $content string 字符串 */


$web = Url::to("@web");
?>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta content="telephone=no" name="format-detection"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>兑换详情</title>
    <link href="<?= $web ?>/css/global.css" rel="stylesheet"/>
    <link href="<?= $web ?>/css/bag/gift-exchange-detail.css" rel="stylesheet"/>
    <script src="<?= $web ?>/js/jquery.js"></script>
    <meta charset="utf-8"/>

    <script type="text/javascript">
        var GOODS_CL_flag='<?=$GOODS_CL_flag?>';
        $(function () {
            // 任何需要执行的js特效
            var w = $(document).width();
            if (w > 640) {
                w = 640;
            }
            $("body").css("font-size", w * 20 / 320);
            var STATUS='<?=$STATUS?>';
            if(STATUS=='2'){
                $(".exchanged-info").hide();

            }
            if(STATUS=='3'){
                $("#v_goods").hide();
            }
            if(GOODS_CL_flag==2){
                $(".exchanged-info").show();
                $("#v_goods").show();
                $('.receive-info-container').hide();
                $('.view-ems').hide();

                var t_html = "<div style='color:#666666; font-size:0.7em;'>"+"<?= $GiftInfo['REMARK']?>"+"<br/>点击商品查看使用方法</div>";
                $(".exchanged-info").html(t_html);
            }
        });
        function href_home(){
            window.location.href = "<?=Url::to(["wx-home/home"]);?>";
        }
        function href_view_wlxx() {
            window.location.href = "<?=Url::to(["wx-home/view-wlxx",'orderNo'=>$GiftInfo['ID'],'giftCode'=>$GiftInfo['GOODS_ID']]);?>" ;
        }
        function href_goods_detail(goods_code) {
            goods_code = encodeURI(goods_code);
            window.location.href = "<?=Url::to(["wx-bag/goods-detail"]);?>?goods_code=" + goods_code;
        }
    </script>
</head>
<body>
<div class="main">
    <div class="gift-container">
        <div class="title-container" style="background-image: url(<?= $web ?>/img/bag/title-bg-normal.png);">
            <div class="title-content">
                <div class="logo" style="background-image: url(<?= $web ?>/img/bag/gift-receives/rectangle.png);"></div>
                <div class="logo-text" style="background-image: url(<?= $web ?>/img/bag/gift-receives/rectangle1.png);"></div>
                <div class="title">
                    <table cellspacing="0" cellpadding="0">
                        <tr>
                            <td id="title-main" style="width: 17em; overflow: hidden; font-size: 0.6em;"><?php
                                $bag_name= $bagInfo['BAG_NAME'];
                                $nick_name= $bagInfo['NICK_NAME'];

                                if($bag_name==""){

                                    echo "来自{$nick_name}的朵拉礼包";
                                }else{
                                    echo $bagInfo['BAG_NAME'];
                                }


                                ?></td>
                        </tr>
                        <tr>
                            <td id="title-desc">有效期：永久</td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="bless-container">
                <div class="user-head">
                    <img src="<?= $bagInfo['HEADER_URL'] ?>" />
                </div>
                <div class="user-bless">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td id="user-target"><?=$bagInfo['NICK_NAME']?>：</td>
                        </tr>
                        <tr>
                            <td id="bless-text"><?=$bagInfo['BLESSING']?></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div style="display: block;" id="v_goods">
        <div class="gift-list">
            <div class="list-item" onclick="href_goods_detail('<?=$goods['GOODS_CODE']?>')">
                <div id="gift-img-div">
                    <img src="<?=$goods['GOODS_IMG_URL']?>"/>
                </div>
                <div class="item-left">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td id="gift-name" style="font-size:0.6em; width:20em;"><?=$goods['GOODS_NAME']?></td>
                        </tr>
                        <tr>
                            <td id="gift-status">已兑换</td>
                        </tr>
                    </table>
                </div>

            </div>

        </div>
        <div class="view-ems" onclick="href_view_wlxx()">
            <div id="ems-left">查看物流信息</div>
            <div id="ems-right">
                <img src="<?= $web ?>/img/bag/go.png"/>
            </div>
        </div>
        <div class="receive-info-container">
            <div class="receive-person">
                收货信息：<?=$GiftInfo['RECEIVER_NAME']?> &nbsp;&nbsp;&nbsp;&nbsp;<?=$GiftInfo['RECEIVER_PHONE']?>
            </div>
            <div class="receive-address">
                <?=$GiftInfo['RECEIVER_PROVINCE']?><?=$GiftInfo['RECEIVER_CITY']?><?=$GiftInfo['RECEIVER_REGION']?><?=$GiftInfo['RECEIVER_ADDRESS']?>
            </div>
        </div>
    </div>
    <div class="exchanged-info">
        <span>已兑换成 <?php
            if($DORACOIN!=null){
                echo $DORACOIN['DORACOIN'];
            }
            ?> 朵拉币</span>
        <div style="text-align: left; margin: 10px; font-size: 0.6em; color:#333333;">
            <p>产品使用描述：</p>
            <p>1.朵拉币可累积使用，不可转赠，无有效时限限制；</p>
            <p>2.开始使用时间：2016年3月1日起开始使用；</p>
            <p>3.适用范围：朵拉商城内朵拉币专区内全场适用，结算支付时直接抵现。使用朵拉币购买的产品不享受分享转赠送。</p>
        </div>
    </div>
    <div class="history-list">
        <div class="history-item">
<!--            <div class="user-head-history">-->
<!--                <img src="--><?//= $bagInfo['HEADER_URL'] ?><!--" />-->
<!--            </div>-->
            <div class="history-info"><?=date("m-d",strtotime($GiftInfo['USER_GET_DATETIME']))?><span><?=$bagInfo['NICK_NAME']?></span> 赠送</div>
            <div class="history-right" onclick="href_home()">给他/她送礼</div>
        </div>
    </div>
</div>


</body>
</html>
